package servlet;

import listener.SessionBindingListener;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/servletC")
public class ServletC extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        ServletContext servletContext = getServletContext();
//        servletContext.setAttribute("key1", "value3");

        HttpSession session = req.getSession();
//        session.setAttribute("attr", "value3");

//        req.setAttribute("attr", "value3");

        session.setAttribute("attr1", new SessionBindingListener());

        session.removeAttribute("attr1");
    }
}
